﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Urb.Weather.Core.UI;
using System.ComponentModel;
using Urb.Weather.Core.MeasureUnit;
using System.Collections.ObjectModel;
using Urb.Weather.Core;

namespace Urb.Weather.Ticker.UI.DesignTime
{
    public class DesignTimeMainViewModel : IMainViewModel
    {
        public DesignTimeMainViewModel()
        {
        }

        public decimal? CurrentTemperature
        {
            get { return 24; }
        }

        public ObservableCollection<TemperatureConditionComponentDataView> CurrentTemperatureComponents
        {
            get
            {
                return new ObservableCollection<TemperatureConditionComponentDataView>()
                {
                    new TemperatureConditionComponentDataView() { SourceName = "Yahoo", MeasurementTime = DateTime.Now.AddMinutes(-20), Value = 20, Unit = TemperatureUnit.Celsius },
                    new TemperatureConditionComponentDataView() { SourceName = "Wunderground", MeasurementTime = DateTime.Now.AddMinutes(-10), Value = 22, Unit = TemperatureUnit.Celsius },
                    new TemperatureConditionComponentDataView() { SourceName = "MSN", MeasurementTime = DateTime.Now.AddMinutes(-15), Value = 21, Unit = TemperatureUnit.Celsius }
                };
            }
        }

        public decimal? MinTemperature
        {
            get { return 18; }
        }

        public decimal? MaxTemperature
        {
            get { return 25; }
        }

        public TemperatureUnit TemperatureUnit
        {
            get { return TemperatureUnit.Celsius; }
        }

        public DateTimeOffset? MinTemperatureMeasurementTime
        {
            get { return DateTime.Now; }
        }

        public DateTimeOffset? MaxTemperatureMeasurementTime
        {
            get { return DateTime.Now; }
        }
        
        public bool AnyTemperatureExtremeRecorded
        {
            get { return true; }
        }
        
        public decimal? CurrentPressure
        {
            get { return 1015; }
        }

        public ObservableCollection<PressureConditionComponentDataView> CurrentPressureComponents
        {
            get
            {
                return new ObservableCollection<PressureConditionComponentDataView>()
                {
                    new PressureConditionComponentDataView() { SourceName = "Yahoo", MeasurementTime = DateTime.Now.AddMinutes(-20), Value = 20, Unit = PressureUnit.HPa },
                    new PressureConditionComponentDataView() { SourceName = "Wunderground", MeasurementTime = DateTime.Now.AddMinutes(-10), Value = 22, Unit = PressureUnit.HPa },
                    new PressureConditionComponentDataView() { SourceName = "MSN", MeasurementTime = DateTime.Now.AddMinutes(-15), Value = 21, Unit = PressureUnit.HPa }
                };
            }
        }

        public decimal? MinPressure
        {
            get { return 1006; }
        }

        public decimal? MaxPressure
        {
            get { return 1018; }
        }

        public PressureUnit PressureUnit
        {
            get { return PressureUnit.HPa; }
        }

        public DateTimeOffset? MinPressureMeasurementTime
        {
            get { return DateTime.Now; }
        }

        public DateTimeOffset? MaxPressureMeasurementTime
        {
            get { return DateTime.Now; }
        }

        public bool AnyPressureExtremeRecorded
        {
            get { return true; }
        }

        public bool AnyExtremeRecorded
        {
            get { return true; }
        }

        public AtmosphereConditionsCode? CurrentAtmosphereConditionsCode
        {
            get { return Core.AtmosphereConditionsCode.FewCloudsDay; }
        }

        public string CurrentAtmosphereConditionsDescription
        {
            get { return "Few clouds"; }
        }

        public ForecastDataView TodayForecast
        {
            get
            {
                return new ForecastDataView()
                {
                    DayOfWeek = DateTime.Now.DayOfWeek,
                    MinTemperature = 16,
                    MaxTemperature = 26
                };
            }
        }

        public ObservableCollection<ForecastDataView> NextDaysForecast
        {
            get
            {
                return new ObservableCollection<ForecastDataView>()
                {
                    new ForecastDataView() { DayOfWeek = DateTime.Now.AddDays(1).DayOfWeek, MinTemperature = 15, MaxTemperature = 28 },
                    new ForecastDataView() { DayOfWeek = DateTime.Now.AddDays(2).DayOfWeek, MinTemperature = 17, MaxTemperature = 26 },
                    new ForecastDataView() { DayOfWeek = DateTime.Now.AddDays(3).DayOfWeek, MinTemperature = 16, MaxTemperature = 30 },
                };
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
